Quiz on Architectural Styles
Test your understanding of the different architectural styles.
Now, let’s imagine that we have a product that makes predictions based on the data provided to it by users. A system like this will have to make complex calculations that will have to be divided between services for better performance. Some of these calculations will be independent, and some will not.
As such, our solution will need to have ways for bidirectional communication. The system will also require minimal latency. This system requires minimal user interaction because all the calculations will be done on the server end, so the data format needs to be binary.
What API paradigm would be best suited for this?
REST
REST will not be effective for this problem because it has no default method for bidirectional communication and will increase latency in situations where the services need to exchange results with one another.
Furthermore, establishing connections between a client and server can take more time in the REST paradigm.
gRPC
The problem above requires a microservices-based solution, where each part of the calculation will be delegated to a different service. gRPC works great in this case because we can take advantage of the channels and subchannels it provides for fast communication between the microservices.
The bidirectional communication provided by gRPC is also very useful in this case because the services will be able to exchange the results of their calculations when they need to.
gRPC also supports the binary data format, which is an advantage for our proposed system.
GraphQL
The implementation of GraphQL for server-to-server communication is rather complex to implement and increases latency. Furthermore, GraphQL has limited support for the binary data format.
Comparisons of Different API Architecture Styles
Introduction to API Security